package com.mine.distinctionteam.http;

import com.google.gson.GsonBuilder;
import com.mine.distinctionteam.bean.home.HomeBean;
import com.mine.distinctionteam.config.HomeConfig;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

/**
 *
 */
public class HomeHttpUtils {
    public static volatile HomeHttpUtils singleHttp;
    public Retrofit retrofit;
    public ILiangPinHui iLiangPinHui;
    private HomeHttpUtils(){
        retrofit=new Retrofit.Builder().baseUrl(HomeConfig.Path.BASE_URL).addConverterFactory(GsonConverterFactory.create(new GsonBuilder().serializeNulls().create())).build();
        iLiangPinHui=retrofit.create(ILiangPinHui.class);
    }
    public static HomeHttpUtils getInstance() {
        if (singleHttp == null) {
            synchronized (UnUsedHttpUtils.class) {
                if (singleHttp == null) {
                    singleHttp = new HomeHttpUtils();
                }
            }
        }
        return singleHttp;
    }

    public void getHomeData(Callback<HomeBean> callback){
        Call<HomeBean> call=iLiangPinHui.getHome();
        call.enqueue(callback);
    }


}
